﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Ue.CQRS.Messaging
{
    /// <summary>
    /// 消息队列
    /// </summary>
    /// <typeparam name="T"></typeparam>
    public interface IQueue<T> where T : class,IMessage
    {
        /// <summary>
        /// 队列名称
        /// </summary>
        string Name { get; }

        /// <summary>
        /// 添加一条消息到队列
        /// </summary>
        /// <param name="message"></param>
        void Enqueue(T message);

        /// <summary>
        /// 移除一条消息，并返这条消息对象
        /// </summary>
        /// <returns></returns>
        T Dequeue();

        /// <summary>
        /// 通知消息已经被处理完成。
        /// </summary>
        /// <param name="message"></param>
        void Complete(T message);
    }
}
